<?php

Route::get('/', 'AuthController@showLoginForm')->name('index');
Route::get('login', 'AuthController@showLoginForm')->name('login');
Route::post('login', 'AuthController@login');
Route::get('logout', 'AuthController@logout')->name('logout');

Route::group(['middleware' => 'auth:admin'], function () {
    Route::post('/upload_image', "CommonController@updateLoad")->name('upload_image');
    Route::any('/overview', "CommonController@overview")->name('overview');
    Route::get('/authorize', "CommonController@checkAuthorize")->name('authorize');
    Route::get('/password', "CommonController@passwordForm")->name('password.from');
    Route::post('/password', "CommonController@updatePassword")->name('password.update');
    Route::get('/search_category', "CommonController@searchCategory")->name('search_category');
    Route::get('/search_user', "CommonController@searchUser")->name('search_user');
    Route::get('/search_shop_good', "CommonController@searchShopGood")->name('search_shop_good');
    Route::get('/search_type_good', "CommonController@searchTypeGood")->name('search_type_good');
    Route::get('/search_package', "CommonController@searchPackage")->name('search_package');
    Route::get('/search_package1', "CommonController@searchPackage1")->name('search_package1');
    Route::get('/search_goods', "CommonController@searchGoods")->name('search_goods');
    Route::get('/search_goods1', "CommonController@searchGoods1")->name('search_goods1');
    Route::get('/search_shops', "CommonController@searchShops")->name('search_shops');
    Route::get('/get_shop_type', "CommonController@getShopType")->name('get_shop_type');

    Route::group(['prefix' => 'personnel'], function () {
        Route::get('', 'PersonnelController@index')->name('personnel.index');
        Route::get('create', 'PersonnelController@create')->name('personnel.create');
        Route::put('', 'PersonnelController@store')->name('personnel.store');
        Route::get('{id}/edit', 'PersonnelController@edit')->name('personnel.edit');
        Route::post('{id}/update', 'PersonnelController@update')->name('personnel.update');
        Route::get('{id}/disable', 'PersonnelController@disable')->name('personnel.disable');
        Route::post('resetpwd', 'PersonnelController@resetpwd')->name('personnel.resetpwd');
        Route::get('sort', 'PersonnelController@changeSort')->name('personnel.sort');
        Route::post('delete', 'PersonnelController@delete')->name('personnel.delete');
        Route::post('export', 'PersonnelController@export')->name('personnel.export');
    });

    Route::group(['prefix' => 'feedback'], function () {
        Route::get("", "FeedbackController@index")->name('feedback.index');
        Route::get("read/{id}", "FeedbackController@read")->name('feedback.read');

    });

    Route::get('group/select', 'GroupController@getGroup')->name('group.select');
    Route::get('group/sort', 'GroupController@changeSort')->name('group.sort');
    Route::resource('/group', 'GroupController', [
        'except' => 'show',
    ]);

    Route::group(['prefix' => 'shop'], function () {
        Route::get('category', 'ShopController@categoryList')->name('shop.category');
        Route::post('category/store', 'ShopController@storeCategory')->name('shop.category.store');
        Route::delete('category/{id}', 'ShopController@deleteCategory')->name('shop.category.delete');

        Route::get('{id}/member', 'ShopController@getMember')->name('shop.member');
        Route::get('{id}/member/create', 'ShopController@createMember')->name('shop.member.create');
        Route::put('{id}/member/store', 'ShopController@storeMember')->name('shop.member.store');

        Route::get('{id}/recommend', 'ShopController@getRecommend')->name('shop.recommend');
        Route::get('{id}/recommend/create', 'ShopController@createRecommend')->name('shop.recommend.create');
        Route::put('{id}/recommend/store', 'ShopController@storeRecommend')->name('shop.recommend.store');
        Route::delete('{id}/recommend', 'ShopController@deleteRecommend')->name('shop.recommend.delete');

        Route::get('banner', 'ShopController@bannerList')->name('shop.banner');
        Route::get('banner/create', 'ShopController@createBanner')->name('shop.banner.create');
        Route::put('banner/store', 'ShopController@storeBanner')->name('shop.banner.store');
        Route::delete('banner/{id}/delete', 'ShopController@delBanner')->name('shop.banner.delete');

        Route::get('sort', 'ShopController@changeSort')->name('shop.sort');

        Route::get('', 'ShopController@index')->name('shop.index');
        Route::get('create', 'ShopController@create')->name('shop.create');
        Route::put('store', 'ShopController@store')->name('shop.store');
        Route::get('{id}/edit', 'ShopController@edit')->name('shop.edit');
        Route::post('{id}/update', 'ShopController@update')->name('shop.update');
        Route::get('{id}/status', 'ShopController@status')->name('shop.status');
    });
    //评论
    Route::group(['prefix' => 'comment'], function () {
        Route::get('index', 'CommentController@commentsIndex')->name('comment.index');
        Route::get("comment/{id}/{is_show}/hide", 'CommentController@hideComment')->name('comment.hide');
        Route::delete('comment/{id}', 'CommentController@destroy')->name('comment.destroy');
        Route::post('reply', 'CommentController@systemReply')->name('comment.reply');
        Route::post('merchantReply', 'CommentController@merchantReply')->name('comment.merchantReply');
        Route::get('read/{id}', 'CommentController@read')->name('comment.read');
        Route::get('merchantDel/{id}', 'CommentController@merchantDel')->name('comment.merchantDel');
        Route::get('getComment/{pid}', 'CommentController@getCommentByPid')->name('comment.getComment');
    });

    //模板消息
    Route::group(['prefix' => 'template'], function () {
        Route::get('index', 'TemplateController@index')->name('template.index');
        Route::get('create', 'TemplateController@create')->name('template.create');
        Route::post('store', 'TemplateController@store')->name('template.store');
        Route::post('{id}/update', 'TemplateController@update')->name('template.update');
        Route::get('{id}/edit', 'TemplateController@edit')->name('template.edit');
        Route::get('sort', 'TemplateController@changeSort')->name('template.sort');
        Route::get('{id}/status', 'TemplateController@status')->name('template.status');
    });

    //充值管理
    Route::group(['prefix' => 'rechargeRecord'], function () {
        Route::get('index', 'RechargeRecordController@rechargeRecordIndex')->name('rechargeRecord.index');
        Route::get('recharge', 'RechargeRecordController@recharge')->name('rechargeRecord.recharge');
        Route::post('store', 'RechargeRecordController@store')->name('rechargeRecord.store');

    });

    //门店下面充值管理
    Route::group(['prefix' => 'recharge'], function () {
        Route::get('index', 'RechargeController@index')->name('recharge.index');
        Route::get('create', 'RechargeController@create')->name('recharge.create');
        Route::post('store', 'RechargeController@store')->name('recharge.store');
        Route::get('select_user', 'RechargeController@selectUser')->name('recharge.select_user');
        Route::get('pkg_index', 'RechargeController@pkgIndex')->name('recharge.pkg_index');
    });

    Route::group(['prefix' => 'package'], function () {

        Route::get('attr', 'PackageController@attrList')->name('package.attr');
        Route::post('attr', 'PackageController@storeAttr')->name('package.attr.store');
        Route::post('attr/{id}/update', 'PackageController@updateAttr')->name('package.attr.update');
        Route::delete('{id}/attr', 'PackageController@deleteAttr')->name('package.attr.delete');
        Route::get('attr/sort', 'PackageController@changeAttrSort')->name('package.attr.sort');

        Route::get('lib', 'PackageController@libList')->name('package.lib');
        Route::get('lib/create', 'PackageController@createLib')->name('package.lib.create');
        Route::get('lib/sort', 'PackageController@changeLibSort')->name('package.lib.sort');
        Route::put('lib', 'PackageController@storeLib')->name('package.lib.store');
        Route::get('lib/{id}/edit', 'PackageController@editLib')->name('package.lib.edit');
        Route::post('lib/{id}/update', 'PackageController@updateLib')->name('package.lib.update');
        Route::delete('lib/{id}/delete', 'PackageController@delLib')->name('package.lib.delete');
        Route::get('lib/search', 'PackageController@searchLib')->name('package.lib.search');

        Route::get('comment', 'PackageController@getComment')->name('package.comment');
        Route::get("comment/{id}/{is_show}/hide", 'PackageController@hideComment')->name('package.comment.hide');

        Route::get('explosive', 'PackageController@explosivePackageIndex')->name('package.explosive');
        Route::get('explosive/create', 'PackageController@createExplosivePackage')->name('package.explosive.create');
        Route::put('explosive', 'PackageController@storeExplosivePackage')->name('package.explosive.store');
        Route::delete('explosive/{id}', 'PackageController@delExplosivePackage')->name('package.explosive.delete');

        Route::get("{id}/rules", "PackageController@editRules")->name('package.rules.edit');
        Route::post("{id}/rules", "PackageController@updateRules")->name('package.rules.update');

        Route::get('sort/change', 'PackageController@changeSort')->name('package.sort');

        Route::get('{id}/gift', 'PackageController@gift')->name('package.gift');
        Route::get('{id}/gift/create', 'PackageController@createGift')->name('package.gift.create');
        Route::post('{id}/gift/store', 'PackageController@storeGift')->name('package.gift.store');
        Route::delete('gift/{id}/destroy', 'PackageController@destroyGift')->name('package.gift.destroy');

        Route::get('', 'PackageController@index')->name('package.index');
        Route::get('create', 'PackageController@create')->name('package.create');
        Route::put('', 'PackageController@store')->name('package.store');
        Route::get('{id}/edit', 'PackageController@edit')->name('package.edit');
        Route::post('{id}/update', 'PackageController@update')->name('package.update');
        Route::get('{id}/status', 'PackageController@status')->name('package.status');
//        Route::get('spec/{id}/edit', 'PackageController@editSpec')->name('package.spec.edit');
//        Route::post('spec/{id}/update', 'PackageController@updateSpec')->name('package.spec.update');

        Route::get('/tag', 'PackageController@indexTag')->name('package.tag');
        Route::get('/tag/create', 'PackageController@createTag')->name('package.tag.create');
        Route::post('/tag', 'PackageController@storeTag')->name('package.tag.store');
        Route::get('/tag/{tag}/edit', 'PackageController@editTag')->name('package.tag.edit');
        Route::put('/tag/{tag}', 'PackageController@updateTag')->name('package.tag.update');
        Route::delete('/tag/{tag}', 'PackageController@destroyTag')->name('package.tag.destroy');
        Route::get('tag/sort', 'PackageController@changeSortTag')->name('package.tag.sort');
    });

    Route::group(['prefix' => 'good'], function () {
        Route::get('{id}/spec/index', 'GoodController@editSpec')->name('good.spec.edit');
        Route::post('{id}/spec/update', 'GoodController@updateSpec')->name('good.spec.update');

        Route::get('comment', 'GoodController@getComment')->name('good.comment');
        Route::get("comment/{id}/{is_show}/hide", 'GoodController@hideComment')->name('good.comment.hide');

        Route::get("{id}/rules", "GoodController@editRules")->name('good.rules.edit');
        Route::post("{id}/rules", "GoodController@updateRules")->name('good.rules.update');

        Route::get('', 'GoodController@status')->name('good.status');
        Route::get('', 'GoodController@index')->name('good.index');
        Route::get('create', 'GoodController@create')->name('good.create');
        Route::get('sort', 'GoodController@changeSort')->name('good.sort');
        Route::put('store', 'GoodController@store')->name('good.store');
        Route::get('{id}/edit', 'GoodController@edit')->name('good.edit');
        Route::post('{id}/update', 'GoodController@update')->name('good.update');
        Route::get('{id}/status', 'GoodController@status')->name('good.status');

        Route::get('category', 'GoodController@indexCategory')->name('good.category');
        Route::get('category/create', 'GoodController@createCategory')->name('good.category.create');
        Route::get('category/sort', 'GoodController@changeCategorySort')->name('good.category.sort');
        Route::post('category/store', 'GoodController@storeCategory')->name('good.category.store');
        Route::get('category/editCategory', 'GoodController@editCategory')->name('good.category.edit');
        Route::put('category/updateCategory', 'GoodController@updateCategory')->name('good.category.update');
        Route::delete('category/destroyCategory', "GoodController@destroyCategory")->name('good.category.destroy');

        Route::get('select_category', 'GoodController@selectCategory')->name('good.select_category');
        Route::get('select_second_category', 'GoodController@selectSecondCategory')->name('good.select_second_category');
        Route::get('select_brand', 'GoodController@selectBrand')->name('good.select_brand');
    });

    Route::group(['prefix' => 'order'], function () {
        Route::get('{id}/detail', 'OrderController@detail')->name('order.detail');
        Route::get("search_shops", "OrderController@searchShops")->name('order.search_shops');
        Route::get("package_index", "OrderController@packageIndex")->name('order.package_index');
        Route::get("good_index", "OrderController@goodIndex")->name('order.good_index');
        Route::get("prepay_index", "OrderController@prepayIndex")->name('order.prepay_index');
        Route::post("{id}/refund", "OrderController@refund")->name('order.refund');
        Route::get("{id}/finish", "OrderController@finish")->name('order.finish');
        Route::delete('{id}/delete', "OrderController@delOrder")->name('order.delete');
        Route::get("{id}/final_payment", "OrderController@finalPayment")->name('order.final_payment');
        Route::get('create', "OrderController@create")->name('order.create');
        Route::any('store', "OrderController@storeOrder")->name('order.store');
        Route::post('select/spec', "OrderController@selectSpec")->name('order.select.spec');

        Route::post('{id}/change_price', "OrderController@changePrice")->name('order.change_price');
    });

    Route::group(['prefix' => 'crowd'], function () {
        Route::get("", "CrowdController@index")->name('crowd.index');
        Route::get("{id}/refund", 'CrowdController@refund')->name('crowd.refund');
        Route::get("{id}/support", "CrowdController@supportList")->name('crowd.support');
        Route::get("support/{id}/refund", "CrowdController@supportRefund")->name('crowd.support.refund');

        Route::get("good", "CrowdController@getGoodList")->name('crowd.good');
        Route::get("good/create", "CrowdController@createGood")->name('crowd.good.create');
        Route::put("good/store", "CrowdController@storeGood")->name('crowd.good.store');
        Route::get("good/{id}/edit", "CrowdController@editGood")->name('crowd.good.edit');
        Route::post("good/{id}/updateGood", "CrowdController@updateGood")->name('crowd.good.update');
        Route::get("good/{id}/status", "CrowdController@status")->name('crowd.good.status');

    });

    Route::group(['prefix' => 'free'], function () {
        Route::get("", "FreeController@index")->name('free.index');
        Route::get("{id}/unlock", "FreeController@unlockList")->name('free.unlock');
        Route::get("{id}/cancel_unlock", "FreeController@cancelUnlock")->name('free.cancel');
        Route::get('{id}/pass_unlock', "FreeController@passUnlock")->name('free.pass');

        Route::get("good", "FreeController@getGood")->name('free.good');
        Route::post("good", "FreeController@addGood")->name('free.good.add');
        Route::get('good/{id}/cancel', "FreeController@cancel")->name('free.good.cancel');

        Route::get("{id}/unlock_good", "FreeController@getUnlockGood")->name('free.unlock_good');
        Route::get('{id}/unlock_good/create', 'FreeController@createUnlockGood')->name('free.unlock_good.create');
        Route::put('{id}/unlock_good/store', 'FreeController@storeUnlockGood')->name('free.unlock_good.store');
        Route::delete("{id}/unlock_good", "FreeController@delUnlockGood")->name('free.unlock_good.delete');
    });

    Route::group(['prefix' => 'rebate'], function () {
        Route::get("", "RebateController@index")->name('rebate.index');
        Route::post("", "RebateController@delRebate")->name('rebate.del');
        Route::get("{id}/revoke", "RebateController@revoke")->name('rebate.revoke');
        // Route::get("{id}/pass", "RebateController@passRebate")->name('rebate.pass');
        Route::post("pass", "RebateController@passRebate")->name('rebate.pass');
        Route::get("search_shops", "RebateController@searchShops")->name('rebate.search_shops');
    });

    Route::group(['prefix' => 'video'], function () {
        Route::get("", "VideoController@index")->name('video.index');
        Route::get("create", "VideoController@create")->name('video.create');
        Route::put("store", "VideoController@store")->name('video.store');
        Route::get("{id}/edit", "VideoController@edit")->name('video.edit');
        Route::post("{id}/update", "VideoController@update")->name('video.update');
        Route::delete("{id}", "VideoController@delete")->name('video.delete');
    });

    Route::group(['prefix' => 'withdrawal'], function () {
        Route::get("", "WithdrawalController@index")->name('withdrawal.index');
        Route::get('{id}/certificate', 'WithdrawalController@certificate')->name('withdrawal.certificate');
        Route::post("{id}/finish", "WithdrawalController@finish")->name('withdrawal.finish');
    });

    Route::group(['prefix' => 'team'], function () {
        Route::get("", "TeamController@index")->name('team.index');
    });

    Route::group(['prefix' => 'coupon'], function () {
        Route::get('user', 'CouponController@userCoupon')->name('coupon.user.index');
        Route::get('send/form', 'CouponController@sendForm')->name('coupon.user.create');
        Route::put('send', 'CouponController@send')->name('coupon.user.send');
        Route::delete('cancel', 'CouponController@cancelUserCoupon')->name('coupon.user.cancel');

        Route::post('{id}/gift', 'CouponController@setGift')->name('coupon.gift');

        Route::get("", "CouponController@index")->name('coupon.index');
        Route::get("create", "CouponController@create")->name('coupon.create');
        Route::put("store", "CouponController@store")->name('coupon.store');
        Route::get("{id}/edit", "CouponController@edit")->name('coupon.edit');
        Route::post("{id}/update", "CouponController@update")->name('coupon.update');
        Route::delete("{id}/delete", "CouponController@deleteCoupon")->name('coupon.delete');
    });

    Route::get("full_reduction/search_shops", "FullReductionController@searchShops")->name('full_reduction.search_shops');
    Route::resource('/full_reduction', 'FullReductionController', [
        'except' => 'show',
    ]);

    Route::get("discount/search_shops", "DiscountController@searchShops")->name('discount.search_shops');
    Route::get('discount/search/goods', 'DiscountController@searchGoods')->name('discount.search.goods');
    Route::resource('/discount', 'DiscountController', [
        'except' => 'show',
    ]);

    Route::get("gift/search_shops", "GiftController@searchShops")->name('gift.search_shops');
    Route::resource('/gift', 'GiftController', [
        'except' => 'show',
    ]);

    Route::get("goods_gift/search_shops", "GoodsGiftController@searchShops")->name('goods_gift.search_shops');
    Route::resource('/goods_gift', 'GoodsGiftController', [
        'except' => 'show',
    ]);


    Route::group(['prefix' => 'authority'], function () {
        Route::get('/role', 'PersonnelController@role')->name('authority.role');
        Route::get('/role/create', 'PersonnelController@createRole')->name('authority.role.create');
        Route::put('/role', 'PersonnelController@addRole')->name('authority.role.add');
        Route::get('/role/{id}/edit', 'PersonnelController@editRole')->name('authority.role.edit');
        Route::post('/role/{id}/update', 'PersonnelController@updateRole')->name('authority.role.update');
        Route::get('{role}/ability', 'PersonnelController@ability')->name('authority.ability');
        Route::post('{role}/allow_ability', 'PersonnelController@allowAbility')->name('authority.ability.allow');
        Route::post('{role}/disallow_ability', 'PersonnelController@disallowAbility')->name('authority.ability.disallow');
    });

    Route::group(['prefix' => 'user'], function () {
        Route::get("", "UserController@index")->name('user.index');
        Route::get("all", "UserController@all")->name('user.all');
        Route::get("{id}/edit", "UserController@editInfo")->name('user.edit');
        Route::post("{id}/update", "UserController@updateInfo")->name('user.update');

        Route::post('export', 'UserController@exportPartner')->name('user.export');

        Route::post('personal', "UserController@updatePersonal")->name('user.personal');
        Route::post('referrer', "UserController@updateReferrer")->name('user.referrer');
        Route::post('batch_referrer', "UserController@batchReferrer")->name('user.batch_referrer');

        Route::get('{id}/member', "UserController@getMember")->name('user.member');
        Route::get('{id}/member/create', "UserController@createMember")->name('user.member.create');
        Route::put('{id}/member', "UserController@storeMember")->name('user.member.store');
        Route::delete('member/{id}', "UserController@delMember")->name('user.member.delete');
        Route::post('{id}/change_quota', "UserController@changeQuota")->name('user.member.change_quota');

        Route::get('staff', 'UserController@getStaff')->name('user.staff');
        Route::get('staff/{id}/edit', 'UserController@editStaff')->name('user.staff.edit');
        Route::post('staff/{id}/update', 'UserController@updateStaff')->name('user.staff.update');

        Route::post('level', "UserController@updateLevel")->name('user.level');
        Route::post('{id}/candidate', "UserController@setReferrerCandidate")->name('user.candidate');

        Route::get("old_user", "UserController@oldUser")->name('user.old');
        Route::post("old_user", "UserController@storeOld")->name('user.old.store');
        Route::delete("old/delete", "UserController@delOld")->name('user.old.delete');

        Route::get('partner/{id}/application', 'UserController@getPartnerApplication')->name('user.partner.application');
        Route::get("application", "UserController@partnerApplication")->name('user.partner.apply');
        Route::get("partner/create", "UserController@createApplication")->name("user.partner.create");
        Route::put('partner/store', "UserController@storeApplication")->name("user.partner.store");
        Route::get("partner/{id}/edit", "UserController@editApplication")->name('user.partner.edit');
        Route::post("partner/{id}/update", "UserController@updateApplication")->name('user.partner.update');

        Route::get("partner/{id}/pass", "UserController@passApplication")->name('user.partner.pass');
        Route::post('partner/{id}/refuse', "UserController@refuseApplication")->name('user.partner.refuse');
    });

    Route::group(['prefix' => 'system'], function () {
        Route::get('banner', "SystemController@bannerList")->name('system.banner');
        Route::get('banner/create', "SystemController@createBanner")->name('system.banner.create');
        Route::put('banner/store', "SystemController@storeBanner")->name('system.banner.store');
        Route::delete('banner/{id}/delete', "SystemController@delBanner")->name('system.banner.delete');

        Route::get('recommend', "SystemController@recommend")->name('system.recommend');
        Route::get('recommend/{id}/edit', "SystemController@editRecommend")->name('system.recommend.edit');
        Route::post('recommend/{id}/update', "SystemController@updateRecommend")->name('system.recommend.update');

        Route::get('page', "SystemController@editPageConfigs")->name('system.page');
        Route::post('page', "SystemController@updatePageConfigs")->name('system.page.update');

        Route::get('rank', "SystemController@Rank")->name('system.rank');
        Route::post('rank', "SystemController@updateRank")->name('system.rank.update');

        Route::get('rule', 'SystemController@ruleList')->name('system.rule');
        Route::get('rule/create', 'SystemController@createRule')->name('system.rule.create');
        Route::put('rule/store', 'SystemController@storeRule')->name('system.rule.store');
        Route::get('rule/{id}/edit', 'SystemController@editRule')->name('system.rule.edit');
        Route::post('rule/{id}/update', 'SystemController@updateRule')->name('system.rule.update');
        Route::delete('{id}/rule', 'SystemController@delRule')->name('system.rule.delete');
        Route::get('rule/sort', 'SystemController@changeRuleSort')->name('system.rule.sort');
    });

    Route::get('category/select', 'CategoryController@selectCategory')->name('category.select');
    Route::get('category/sort', 'CategoryController@changeSort')->name('category.sort');
    Route::resource('/category', 'CategoryController', [
        'except' => 'show',
    ]);

    Route::get('brand/select', 'BrandController@getSelectBrand')->name('brand.select');
    Route::get('brand/sort', 'BrandController@changeSort')->name('brand.sort');
    Route::resource('/brand', 'BrandController', [
        'except' => 'show',
    ]);

    Route::get('tag/select', 'TagController@getTag')->name('tag.select');
    Route::get('tag/sort', 'TagController@changeSort')->name('tag.sort');
    Route::resource('/tag', 'TagController', [
        'except' => 'show',
    ]);
});
